iT邦幫忙

2025 iThome 鐵人賽

DAY 3
0

Mac 的安裝方式都是用終端機解決

前置作業

如果你的 Mac 已經可以執行 npm 指令,就可以跳過這段

安裝 Homebrew

官網:https://brew.sh/

  1. 開啟終端機
  2. 從官網複製指令或者複製以下指令執行
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  3. 如果執行出現 ERROR,把錯誤訊息丟給 Google 翻譯會有答案,例如我遇到要先執行 Clone,然後再重新安裝
    git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
    
  4. 中間可能會等一陣子,就放著不要管他

安裝 Node.js

  1. 開啟終端機
  2. 複製以下指令執行
    brew install node
    
  3. 中間可能會等一陣子,就放著不要管他

安裝 Gemini CLI

  1. 開啟終端機
  2. 複製以下指令執行
    sudo npm install -g @google/gemini-cli
    

測試成功安裝

Node.js

  • 輸入第一行後,第二行會出現版本號
    你的名字 ~ % node -v
    v22.19.0
    

npm

  • 輸入第一行後,第二行會出現版本號
    你的名字 ~ % npm -v
    10.9.3
    

Gemini CLI

  • 輸入第一行後,第二行會出現版本號
    你的名字 ~ % gemini -v
    0.4.0    
    

執行 Gemini CLI

  1. 開啟終端機
  2. 執行指令 gemini
    你的名字 ~ % gemini
    
  3. 看到這個畫面就表示 Gemini CLI 執行囉
 ███            █████████  ██████████ ██████   ██████ █████ ██████   █████ █████
░░░███         ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
  ░░░███      ███     ░░░  ░███  █ ░  ░███░█████░███  ░███  ░███░███ ░███  ░███
    ░░░███   ░███          ░██████    ░███░░███ ░███  ░███  ░███░░███░███  ░███
     ███░    ░███    █████ ░███░░█    ░███ ░░░  ░███  ░███  ░███ ░░██████  ░███
   ███░      ░░███  ░░███  ░███ ░   █ ░███      ░███  ░███  ░███  ░░█████  ░███
 ███░         ░░█████████  ██████████ █████     █████ █████ █████  ░░█████ █████
░░░            ░░░░░░░░░  ░░░░░░░░░░ ░░░░░     ░░░░░ ░░░░░ ░░░░░    ░░░░░ ░░░░░

Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. Create GEMINI.md files to customize your interactions with Gemini.
4. /help for more information.

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ You are running Gemini CLI in your home directory. It is recommended to run in a project-specific directory.                                                  │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯



╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ >   Type your message or @path/to/file                                                                                                                        │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
~                                                  no sandbox (see /docs)                                                    gemini-2.5-pro (100% context left)

上一篇
114/02 - 選一個 AI 工具來寫程式
下一篇
114/03 - 安裝 Gemini CLI(Windows)
系列文
看見筆記捲土重來,試著用 Vibe Coding 完成一款 App 吧!5
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

我要留言

立即登入留言